import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
  {
    path: '/',
    name: 'HomeView',
    component: () => import('@/views/box'),
    meta: {
      title: '旋转盒子'
    }
  },
  {
    path: '/togranary',
    name: 'ToGranary',
    component: () => import('@/views/togranary'),
    meta: {
      title: '数字粮仓'
    }
  }
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})
// 设置路由title
router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})
export default router
